<?php
header('Content-type:text/html;charset=utf-8');
error_reporting(E_ALL);
include './simphp/autoload.php';
$app = new \simphp\App();

$app->setObject('view', new \simphp\View([
    'dir' => __DIR__ . '/view/dist/',
    'cache_dir' => __DIR__ . '/cache/'
]));
function json($o){
  echo json_encode($o, true);
};
$app->get('/phpinfo', function () {
  phpinfo();
});
// $app->get('/qrcode', function () {
//   $this->view->assign('storyImg', '/story_img/10.jpg');
//   $this->view->display('qrcode');
// });
$app->get('/upgrade', function () {
  $this->view->display('upgrade');
});
$app->get('/getcard', function () {
  $this->view->display('getcard');
});
$app->get('/topic', function () {
  $this->view->display('topic');
});
$app->get('/bindPhone', function () {
  $this->view->display('bindPhone');
});
$app->get('/score', function () {
  $this->view->display('score_estimate');
});
$app->get('/diagnosis', function () {
  $this->view->display('diagnosis');
});
$app->get('/diagnostic', function () {
  $this->view->display('diagnostic');
});
$app->post('/Zkgf/Admin/login',function(){
  json(json_decode('{"error":"0","errMsg":"登录成功"}'));
});
$app->get('/diagnostic/grade/getGrades', function () {
  json(json_decode('{"gradeInfos": [{"id": "1","grade": "中班","status": "1","c_ids": null},{"id": "2","grade": "大班","status": "1","c_ids": null},{"id": "3","grade": "一年级","status": "1","c_ids": null},{"id": "4","grade": "二年级","status": "1","c_ids": null},{"id": "5","grade": "三年级","status": "1","c_ids": null},{"id": "6","grade": "四年级","status": "1","c_ids": null},{"id": "7","grade": "五年级","status": "1","c_ids": null},{"id": "8","grade": "六年级","status": "1","c_ids": null},{"id": "9","grade": "七年级","status": "1","c_ids": null},{"id": "10","grade": "八年级","status": "1","c_ids": null},{"id": "11","grade": "九年级","status": "1","c_ids": null},{"id": "12","grade": "高一","status": "1","c_ids": null},{"id": "13","grade": "高二","status": "1","c_ids": null},{"id": "14","grade": "高三","status": "1","c_ids": null},{"id": "15","grade": "大一","status": "1","c_ids": null}],"totalPage": 1,"page": 1,"count": "15","limit": "20","message": "获取年级信息成功！","code": "1000"}'));
});
$app->get('/diagnostic/Course/getCourses', function () {
  json(json_decode('{"courseInfos": [{"id": "1","course": "语文","status": "1"},{"id": "2","course": "数学","status": "1"},{"id": "3","course": "英语","status": "1"},{"id": "4","course": "物理","status": "1"},{"id": "5","course": "化学","status": "1"},{"id": "6","course": "生物","status": "1"},{"id": "7","course": "政治","status": "1"},{"id": "8","course": "历史","status": "1"},{"id": "9","course": "地理","status": "1"}],"totalPage": 1,"page": 1,"count": "9","limit": "20","message": "获取科目信息成功！","code": "1000"}'));
});
$app->post('/diagnostic/Index/getClassInfo', function () {
  json(json_decode('{"classInfos":[{"id":"3","name":null,"c_id":"1","g_id":"8","start_time":"1504832400","end_time":"1504834200","number":"2","t_id":"6","add_time":"1505119680","signup_number":"0","status":"1","signup_status":"0"},{"id":"6","name":null,"c_id":"1","g_id":"8","start_time":"1504832400","end_time":"1504834200","number":"2","t_id":"6","add_time":"1505131054","signup_number":"1","status":"1","signup_status":"0"}],"message":"获取课程信息成功！","code":"1000"}'));
});
$app->post('/diagnostic/Index/saveSignupInfo', function () {
  json(json_decode('{"code":1000}'));
});
$app->get('/diagnostic/admin/islogin', function () {
  json(json_decode('{"login_status":2,"admin_id":1}'));
});
$app->get('/diagnostic/Signupinfo/getSignupInfos', function () {
  json(json_decode('{"signupInfos":[{"id":"2","name":"老江","phone":"13034567891","qq":"1024125678","c_id":"1","g_id":"8","class_id":"3","signup_time":"1505130947","status":"2","t_id":1,"update_time":null,"start_time":"1504749600","end_time":"1504751400"},{"id":"4","name":"’老江‘","phone":"13034567891","qq":"1024125678","c_id":"2","g_id":"1","class_id":"2","signup_time":"1505187495","status":"1","t_id":2,"update_time":null,"start_time":"1504749600","end_time":"1504751400"},{"id":"5","name":"纪广财","phone":"18825053886","qq":"708882196","c_id":"1","g_id":"8","class_id":"3","signup_time":"1505208183","status":"2","t_id":2,"update_time":null,"start_time":"1504749600","end_time":"1504751400"},{"id":"6","name":"赵晨希","phone":"18620181427","qq":"414159937","c_id":"1","g_id":"8","class_id":"3","signup_time":"1505209495","status":"1","t_id":null,"update_time":null,"start_time":"1504749600","end_time":"1504751400"}],"totalPage":1,"page":1,"count":"4","limit":"20","message":"获取报名信息成功！","code":"1000"}'));
});
$app->get('/diagnostic/Signupinfo/getOneEvaluation', function () {
  json(json_decode('{"evaluationInfo":{"id":"1","s_id":"2","content":"不错不错\n","paper":null},"message":"获取测评信息成功！","code":"1000"}'));
});


$app->get('/diagnostic/Admin/getTeachers', function () {
  json(json_decode('{"teacherInfos":[{"id":"1","username":"This is username","password":"4a208008f000d05a9c025e573dfe7581","salt":"jzdcK[","realname":"真名","g_id":"1","c_id":"1","phone":"13712345678","status":"0","power":"1","create_time":"1505115876","login_time":"1505115876","login_ip":"58.248.173.76"}],"totalPage":1,"count":"1","page":1,"limit":"20","message":"获取诊断老师信息成功！","code":"1000"}'));
});
$app->get('/diagnostic/Admin/getOneTeacher', function () {
  json(json_decode('{"teacherInfo":{"id":"3","username":"13022657896","password":"e3cf57b16d9ff42f78163898fd58322a","salt":"53hzvt","realname":"\u8001\u5e08","g_id":"1","c_id":"2","phone":"13022657896","status":"2","power":"1","create_time":"1505184843","login_time":"1505184843","login_ip":"58.248.173.76"},"message":"\u83b7\u53d6\u8bca\u65ad\u8001\u5e08\u4fe1\u606f\u6210\u529f\uff01","code":"1000"}'));
});
$app->get('/diagnostic/Classinfo/getClasses', function () {
  json(json_decode('{"classInfos":[{"id":"1","name":null,"c_id":"2","g_id":"9","start_time":"1504749600","end_time":"1504751400","number":"5","t_id":"1","add_time":"1505119680","signup_number":"0","status":"1","teacher":"真名"},{"id":"2","name":null,"c_id":"3","g_id":"14","start_time":"1504749600","end_time":"1504751400","number":"1","t_id":"5","add_time":"1505119680","signup_number":"1","status":"1","teacher":"老师"},{"id":"3","name":null,"c_id":"1","g_id":"8","start_time":"1504832400","end_time":"1504834200","number":"2","t_id":"6","add_time":"1505119680","signup_number":"2","status":"1","teacher":null},{"id":"4","name":null,"c_id":"2","g_id":"9","start_time":"1504749600","end_time":"1504751400","number":"5","t_id":"1","add_time":"1505131054","signup_number":"0","status":"1","teacher":"真名"},{"id":"5","name":null,"c_id":"3","g_id":"14","start_time":"1504749600","end_time":"1504751400","number":"1","t_id":"5","add_time":"1505131054","signup_number":"0","status":"1","teacher":"老师"},{"id":"6","name":null,"c_id":"1","g_id":"8","start_time":"1504832400","end_time":"1504834200","number":"2","t_id":"6","add_time":"1505131054","signup_number":"1","status":"1","teacher":null}
  ],"totalPage":1,"page":1,"count":"6","limit":"20","message":"获取课程信息成功！","code":"1000"}'));
});

$app->get('/Zkgf/Admin/examList', function () {
  json(json_decode('[
      {
          "id": "1",
          "exam_name": "中考",
          "statement": "120"
      },
      {
          "id": "2",
          "exam_name": "二模",
          "statement": "120"
      }
  ]'));
});
$app->get('/Zkgf/Admin/paperList', function () {
  json(json_decode('[
    {
        "id": "1",
        "subject": "语文",
        "score": "120",
        "status": "1",
        "material":""
    },
    {
        "id": "2",
        "subject": "数学",
        "score": "120",
        "status": "0",
        "material":""

    }
]'));
  // json(json_decode('{"error":"1"}'));
});
$app->post('/Zkgf/Admin/login',function(){
  json(json_decode('{"error":"0","errMsg":"登录成功"}'));
});
$app->get('/Zkgf/Admin/createPaper', function () {
  json(json_decode('[{
        "id": "2",
        "paper_id": "1",
        "question": "<p>testt</p>",
        "answer": "C",
        "score": "2",
        "answer_num": "4",
        "status": "1"
    },
    {
        "id": "3",
        "paper_id": "1",
        "question": "<p>test222</p>",
        "answer": "CA",
        "score": "2",
        "answer_num": "4",
        "status": "1"
    }]'));
  // json(json_decode('{"error":"1"}'));
});
$app->post('/Zkgf/Admin/createExam', function () {
  json(json_decode('{"error":"0","errMsg":"创建考试成功"}'));
});
$app->post('/Lecture/Tool/uploadImg', function () {
  echo "test";
});

$app->get('/Lecture/Listener/liveBaseinfo', function () {
  json(json_decode('{
"id": "3",
"unionid": "oiTCLt7sZwBVY3HQ3IU0gdys1e3Q",
"course_id": "3",
"live_id": "2",
"c_time": "4294967295",
"sign": "sign1",
"openid": "oH8Gzjgkf0MIRX6MTv2RGjninSc8",
"headimgurl":"http://wx.qlogo.cn/mmopen/icNOt9NWMmnicibeG7V9gWu5ZOBWBrO3208bIjv2cpbic9S1KHVZMh1xnfZsKSHUcEI6VVm5LrZWdTlRLosSNsQRsUicPkKw9Q4ZV/0",
"nickname": "万林赞",
"status": "0",
"identify":"1",
"course_name": "",
"error": "0"
}',true));
});
$app->get('/Lecture/Message/list_z', function () {
  json(json_decode('[
                  {
                  "key": "key1493378018033",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "http://weixin-voice.oss-cn-hangzhou.aliyuncs.com/mts/591d159f5ddef.mp3",
                  "message_type": 2,
                  "indentify": 1,
                  "second": 5,
                  "flag": 1,
                  "c_time": 1493378018000
                  },
                  {
                  "key": "key1493378018000",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "http://weixin-voice.oss-cn-hangzhou.aliyuncs.com/mts/59102ddfcc76e.mp3",
                  "message_type": 2,
                  "indentify": 1,
                  "second": 9,
                  "flag": 1,
                  "c_time": 1493378018000
                },
                {
                "key": "key1493378013330",
                "liveid": 1,
                "unionid": "ygherbesrbejhrjesjrhe",
                "openid": "yhghdsfgehrye",
                "course_id": 1,
                "sign": "chfg457ysdhjfedfrr4596760okgt",
                "nickname": "hengjian",
                "headimgurl": "http://www.jb51.net/images/logo.gif",
                "content": "http://weixin-voice.oss-cn-hangzhou.aliyuncs.com/mts/591d159f5ddef.mp3",
                "message_type": 2,
                "indentify": 1,
                "second": 4,
                "flag": 1,
                "c_time": 1493378018000
                },
                  {
                  "key": "qqq",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "http://weixin-voice.oss-cn-hangzhou.aliyuncs.com/hand_out/594a1d61ebfd4.jpeg",
                  "message_type": "1",
                  "indentify": 1,
                  "flag": 1,
                  "c_time": 14498747574754564
                  },
                  {
                  "key": "key1493378205000",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "测试",
                  "message_type": 0,
                  "indentify": 1,
                  "flag": 1,
                  "c_time": 1493378205000
                  },
                  {
                  "key": "key1493378566000",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "测试",
                  "message_type": 0,
                  "indentify": 1,
                  "flag": 1,
                  "c_time": 1493378566000
                  },
                  {
                  "key": "key1493378127000",
                  "liveid": 1,
                  "unionid": "ygherbesrbejhrjesjrhe",
                  "openid": "yhghdsfgehrye",
                  "course_id": 1,
                  "sign": "chfg457ysdhjferr4596760okgt",
                  "nickname": "hengjian",
                  "headimgurl": "http://www.jb51.net/images/logo.gif",
                  "content": "测试",
                  "message_type": 0,
                  "indentify": 1,
                  "flag": 1,
                  "c_time": 1493378127000
                  }
                  ]',true));
});
$app->get('/Lecture/Message/list_t', function () {
  json(json_decode('[
                      {
                      "key": "1493802999000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😊😊😊😊",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493802999000
                      },
                      {
                      "key": "1493802999000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😊😊😊😊",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493802999000
                      },
                      {
                      "key": "1493802999000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😊😊😊😊",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493802999000
                      },
                      {
                      "key": "1493802999000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😊😊😊😊",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493802999000
                      },
                      {
                      "key": "1493802994000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😁😂😊☺😡😌😖😫",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493802994000
                      },
                      {
                      "key": "1493803007000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😱😱😱😱😱",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493803007000
                      },
                      {
                      "key": "1493803146000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😥😌😔",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493803146000
                      },
                      {
                      "key": "1493803001000_11",
                      "liveid": "22",
                      "unionid": "11",
                      "openid": "123",
                      "course_id": "22",
                      "sign": "www123456789",
                      "nickname": "倔强的石头",
                      "headimgurl": "http://cdn.gzpeiyou.com/broad/img/avater.png",
                      "content": "😓",
                      "message_type": 0,
                      "identity": 0,
                      "flag": 1,
                      "reply_content": "",
                      "c_time": 1493803001000
                      }
                    ]'));
});


$app->get('/Lecture/Lecture/getCourseInfo', function () {
  // var_dump(json_decode('{"test":"ddd"}',true));
  json(json_decode('
  {
      "error": 0,
      "info": {
          "id": "1",
          "name": "高考提分10种方法",
          "tag": "高考,提分",
          "type": "高中",
          "cost": "100",
          "reward_status": "1",
          "number": "111",
          "teacher": "一流的老师，曾经参加过世界级奥数比赛",
          "intro": "带你装逼带你飞",
          "poster": "",
          "moments_cover": "",
          "moments_intro": "",
          "status": "",
          "live_title": "",
          "start_time": "4234234234234",
          "lecturer_url": "",
          "listener_url": "",
          "ticket": "",
          "sign": "sign1",
          "live_name": "",
          "series_name": "",
          "liveid": "2",
          "reply_count": "0",
          "is_disabled": "1"
      }
    }',true));

  // json(array(
  //   // 'testLogo' => 'http://cdn.gzpeiyou.com/single/img/topic/testLogo.jpg',
  //   // 'path' => 'http://cdn.gzpeiyou.com/single/',
  //
  //   'testLogo' => '../view/dist/img/topic/testLogo.jpg',
  //   'path' => '../view/dist/',
  //
  //   'title' => '如何更快更好地开发一款适合幼小学生表达能力训练的产品。',
  //
  //   'ownerName'=>'纪广财',
  //   'ownerLogo'=>'',
  //   'peopleCount'=>'50', // 人次 或 当前在线人数？
  // ));
});







$app->run();
